cmake_minimum_required(VERSION 3.8.0)

set(project_name examples)
project(${project_name})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_FLAGS "-g -Wall")

find_package(Qt5 COMPONENTS
    Core
    Gui
    Widgets
    Concurrent
    REQUIRED
)

set(Qt_LIBS
    Qt5::Core
    Qt5::Gui
    Qt5::Widgets
    Qt5::Concurrent
)

set(LINK_DIR ${PROJECT_SOURCE_DIR}/src/3rdparty)

SET(SOURCES
    main.cpp
    mainwindow.h
    mainwindow.cpp
)

add_executable(${project_name})

target_sources(${project_name} PRIVATE
    ${SOURCES}
)

target_include_directories(${project_name} PRIVATE
    ${CMAKE_SOURCE_DIR}/3rdparty/pythonqt-3.2/src
    ${CMAKE_SOURCE_DIR}/3rdparty/pythonqt-3.2/src/gui
)

target_link_directories(${project_name} PRIVATE
    ${CMAKE_SOURCE_DIR}/3rdparty/lib
    ${CMAKE_SOURCE_DIR}/3rdparty/pythonqt-3.2/bbuild/lib
)

target_link_libraries(${project_name} PRIVATE
    ${Qt_LIBS}
)

IF (WIN32)
    MESSAGE(STATUS "Now is windows")
    target_include_directories(${project_name} PRIVATE
        "C:/Program Files (x86)/Python37-32/include"
    )
    target_link_libraries(${project_name} PRIVATE
        PythonQt-Qt5-Python373
    )

    file(COPY "${CMAKE_SOURCE_DIR}/3rdparty/lib/PythonQt-Qt5-Python373.dll" DESTINATION ${CMAKE_BINARY_DIR}/${project_name}  FOLLOW_SYMLINK_CHAIN)

ELSEIF (UNIX)
    MESSAGE(STATUS "Now is UNIX-like OS's.")
    target_include_directories(${project_name} PRIVATE
        /usr/include/python3.8
    )
    target_link_libraries(${project_name} PRIVATE
        PythonQt-Qt5-Python3.8
        python3.8
    )
ENDIF ()

